package t6;

 class Student implements Comparable<Student> {
    String age;
    String name;

     public Student(String age, String name) {
         this.age = age;
         this.name = name;
     }

     public Student() {
    }

     public String getAge() {
         return age;
     }

     public void setAge(String age) {
         this.age = age;
     }

     public String getName() {
         return name;
     }

     public void setName(String name) {
         this.name = name;
     }

     @Override
     public String toString() {
         return "Student{" +
                 "age=" + age +
                 ", name='" + name + '\'' +
                 '}';
     }

     @Override
     public int compareTo(Student o) {
         if (this == o || this == null) {
             return 0;
         }
         if (this.name == o.name) {
             return age.compareTo(o.age);
         }
         return name.compareTo(o.name);
     }
 }
